/**
 * @Project Name:hoofungson-elk-log
 * @Package Name:cn.hoofungson.framework.elk.log.util
 * @Since JDK 1.8
 */

package cn.hoofungson.framework.elk.log.util;


import cn.hoofungson.framework.elk.log.annotation.LogServiceContext;

/**
 * @Description: 线程本地工具
 * @Author 胡松 hoofungson@163.com
 * @Date 2019-08-30 15:48
 * @Version V1.0
 */
public class ThreadLocalUtils {

    /**
     * 声明一个上下文线程本地变量
     **/
    private static ThreadLocal<LogServiceContext> logServiceContextThreadLocal;

    private ThreadLocalUtils() {
    }

    /**
     * 获取日志业务上下文线程本地变量
     *
     * @return
     **/
    public static ThreadLocal<LogServiceContext> getLogServiceContextThreadLocal() {
        if (null == logServiceContextThreadLocal) {
            logServiceContextThreadLocal = new ThreadLocal<>();
        }
        return logServiceContextThreadLocal;
    }
}
